#!/bin/bash


function do_test() {
    for i in ${1}/*; do
        if [ -x ${i} ]; then
            ${i} > /dev/null 2>&1
            res=$?
            filename=`basename $i`
            case ${res} in
                0)
                    echo -e "\033[32mtest ${filename} success\033[0m";;
                *)
                    echo -e "\033[31mtest ${filename} failed, return ${res} \033[0m";;
            esac
        fi
    done

}

BASE_DIR=`pwd`

export LSAN_OPTIONS="suppressions=${BASE_DIR}/asan_check/suppressions.txt"
echo $LSAN_OPTIONS

do_test ${BASE_DIR}/output/bin/test/comm
do_test ${BASE_DIR}/output/bin/test/event
